<?php
require_once("userView.php");
require_once(CORE_DIR.'userModel.php');

class getusersbyprojAction extends Action{

	function __construct(){
		$this->view = new userView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$uModel = new userModel();
		
		if (isset($get["prjid"])){
			$projectID = $get["prjid"];
			
			$done = (isset($get["done"]) && $get["done"] == 1) ? 1 : 0;
			$period = isset($get["period"]) ? $get["period"] : 'today';
			
			$users = $uModel->getUsersListByProject($projectID, $done, $period);
			
			$this->view->setProperty("users", $users);
			$this->view->showUsersListByProject();
		}
		else {
			$this->view->showBadCmd();
		}
	}
}
?>